<?php
// Hour Table
//	Expects an array from the hours Model ($hours) and edit link title and url ($editType, $editAction)
?>
<?php $this->Html->script(array('hourTable'), array('inline'=>false)) ?>
<div class='prefix_10 grid_2 alpha omega center'>
	<button onclick='printHourTable(<?php echo json_encode(array(
			'name'=>$employee['Employee']['name'],
			'id'=>$employee['Employee']['employee_id']
		)) ?>,$("#hourTable"))'>Print Table</button>
</div>
<div id='hourTable' class='grid_12 alpha omega'>
	<table><tbody>
		<tr>  
			<th>Date</th>
			<th>Clock In/Out</th>  
			<th>Project</th> 
			<th>Created By</th>
			<th>Edit</th>

		</tr>  
		<?php foreach($hours as $hour): ?><tr>    
			<td><?php echo $hour['Hour']['date']; ?></td> 
			<td><?php if(!empty ($hour['Hour']['clock_in'])){ echo 'IN';}else{echo 'OUT';} ?></td>    
			<td><?php echo $hour['Hour']['proj_id'].':'.$hour['Hour']['proj_name']; ?></td>
			<td><?php echo $hour['Hour']['created_by']; ?></td>   
			<?php array_push($editAction, $hour['Hour']['trans_id']);?>
			<td><?php echo $this->Html->link($editType,$editAction); ?></td>   
			<?php array_pop($editAction); ?>
		</tr><?php endforeach; ?>  
	</tbody></table>
</div>
